local skel = fk.CreateSkill{
  name = "kt_st__xiaohun",
  tags = { Skill.Lord, Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["kt_st__xiaohun"] = "消魂",
  [":kt_st__xiaohun"] = "主公技，锁定技，游戏开始时，我向牌堆中添加隋势力角色数张【无中生有】。",

  ["$kt_st__xiaohun"] = "斜阳欲落去，一望黯消魂...",

}

local U = require "packages/utility/utility"

skel:addEffect(fk.GameStart, {
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(skel.name) and
    table.find(player.room.alive_players, function (p)
        return p.kingdom == "sui"
      end)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local name = "ex_nihilo"
    local cards = {}
    local numb =#table.filter(room.alive_players, function (p)
      return p.kingdom == "sui"
    end)
    for i=1,numb do
      table.insert(cards,{name, Card.Heart, 12})--算了，就都红桃Q吧
    end
    for _, id in ipairs(U.prepareDeriveCards(room, cards, skel.name)) do--直接复制的神荀彧的技能逻辑
      if room:getCardArea(id) == Card.Void then
        table.removeOne(room.void, id)
        table.insert(room.draw_pile, math.random(1, #room.draw_pile), id)
        room:setCardArea(id, Card.DrawPile, nil)
      end
    end
    room:syncDrawPile()
    room:doBroadcastNotify("UpdateDrawPile", tostring(#room.draw_pile))
  end,
})

return skel